﻿@model IEnumerable<PartyManagement.Models.Event>
@using PartyManagement.Models;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_MyLayout.cshtml";
    Event even =  new Event();
     
}
<header>
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/jqueryui")
</header>
<h2>Index</h2>


<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.eventName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.dateEvent)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.endDateBook)
        </th>
      
      
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.eventName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.dateEvent)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.endDateBook)
        </td>
        <td>
             @Html.Hidden("userID",Session["userID"])
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.eventID }) |
            @Html.ActionLink("Details", "Details", new { id=item.eventID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.eventID })
        </td>
    </tr>
}

</table>
<p>
    @*@Html.ActionLink("Create New", "Create")*@
   <input value="Create" name="create" id="create"/>
</p>
   <script>
   

 </script>
<div class="create">
    @using (Html.BeginForm("Create","BookEvent")) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Event</legend>

        <div class="editor-label">
            @Html.LabelFor(model => even.eventName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => even.eventName)
            @Html.ValidationMessageFor(model => even.eventName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => even.dateEvent)

        </div>
        <div class="editor-field">
            @Html.EditorFor(model => even.dateEvent)
             <script>
                 //$(function () {
                 $("#dateEvent").datepicker();
                 //});
              </script>
            
            @Html.ValidationMessageFor(model => even.dateEvent)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => even.endDateBook)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => even.endDateBook)
            @Html.ValidationMessageFor(model => even.endDateBook)
             <script>
                 //$(function () {
                 $("#endDateBook").datepicker();
                 //});
            </script>
        </div>


        <div class="editor-field">
           @Html.Hidden("userID",Session["userID"])
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

</div>

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

